package com.tiamo.common.web.controller;

import com.tiamo.common.web.response.WebResponse;

/**
 * @author luozhiwei
 * @date 2023/4/17 下午11:54
 */
public interface BaseController {

    default WebResponse ok() {
        return WebResponse.builder().msg("success").build();
    }

    default WebResponse ok(Object data) {
        return WebResponse.builder().msg("success").data(data).build();
    }

    default WebResponse defaultErr() {
        return WebResponse.builder().code(-1).build();
    }

    default WebResponse defaultErr(String msg) {
        return this.defaultErr().setMsg(msg);
    }
}
